// $Id$

#ifndef __FTRTCS_DOWNSENSOR_H__
#define __FTRTCS_DOWNSENSOR_H__

#include "ace/Time_Value.h" // for time value data structure
#include "ace/Event_Handler.h" // for event handling

#include "tao/Basic_Types.h"  // all the CORBA basic types
#include "tao/ORB.h"          // the ORB itself

#include "ftrtcs/SegmentNEANodeC.h"
#include <iostream>
#include <fstream>
#include <sstream>

/// An OO abstraction of the sensor object.
class DownSensor : public ACE_Event_Handler
{
public:

  // constructor
  DownSensor (CORBA::ORB_ptr orb);

  /// destructor
  ~DownSensor (void);

  /// parse arguments
  int parse_args (int argc, char *argv[]);

  /// initialization, where we register ourselves for a timeout
  int init (void);

  /// handle timeout method
  int handle_timeout (const ACE_Time_Value &current_time, const void *act=0);

private:
  /// maintain a smart pointer to the ORB
  CORBA::ORB_var orb_;

  /// IOR of the NEANode component
  CORBA::String_var ior_;

  /// our sensing rate
  CORBA::ULong  freq_;

  /// timer id
  long  timer_id_;

  /// the NEANode object
  Block::Segment::SegmentNEANode_var  node_;
};

#endif /* __FTRTCS_DOWNSENSOR_H__ */
